package com.googlecode.bip.dao;

import java.io.Serializable;
import java.sql.SQLException;
import java.util.List;
import javax.naming.NamingException;
import com.googlecode.bip.entity.IUserReferent;

/**
 * DAO for {@link IUserReferent}
 */
public interface UserReferentDAO extends Serializable
{
    /**
     * Returns an {@link IUserReferent} from iduser and idreferent
     *
     * @param iduser     a valid iduser ({@link com.googlecode.bip.entity.IUser#getIdUser()})
     * @param idreferent a valid idreferent ({@link com.googlecode.bip.entity.IReferent#getIdReferent()})
     * @return an {@link IUserReferent} if relation exist, null otherwise
     * @throws NamingException if any
     * @throws SQLException if any
     */
    public abstract IUserReferent findUserReferent(
        int  iduser,
        int  idreferent
        ) throws NamingException, SQLException;

    /**
     * Returns a list of all define {@link IUserReferent} for an iduser
     *
     * @param iduser     a valid iduser ({@link com.googlecode.bip.entity.IUser#getIdUser()})
     * @return a list of {@link IUserReferent} for an iduser
     * @throws NamingException if any
     * @throws SQLException if any
     */
    public abstract List<IUserReferent> findUserReferents(
        int  iduser
        ) throws NamingException, SQLException;

    /**
     *
     * @param iduser
     * @param idreferent
     * @return
     * @throws NamingException if any
     * @throws SQLException if any
     */
    public IUserReferent insertUserReferent( int iduser, int idreferent )
        throws NamingException, SQLException;

    /**
     *
     * @param iduser
     * @param idreferent
     * @return
     * @throws NamingException if any
     * @throws SQLException if any
     */
    public abstract boolean deleteUserReferent(
        int  iduser,
        int  idreferent
        ) throws NamingException, SQLException;

    /**
     *
     * @param userReferent
     * @return
     * @throws NamingException if any
     * @throws SQLException if any
     */
    public boolean deleteUserReferent(
           IUserReferent userReferent
           ) throws NamingException, SQLException;

    /* NOT UPDATE
    public abstract boolean updateUserReferent( ... )
        throws NamingException, SQLException;
    */
}

